import React from 'react'
import { routes, RouteState } from './routes'
import { BrowserRouter as Router, Routes, Route } from 'react-router-dom'
const renderRoute = (routes: RouteState[]) => {
	return <>
		{
			routes.map((v, i) => {
				return <Route key={i} path={ v.path } element={ <v.element></v.element> }>
					{ v.children && renderRoute(v.children) }
				</Route>
			})
		}
	</>
}
const Index: React.FC = () => {
	return (
		<Router>
			<Routes>
				{ renderRoute(routes) }
			</Routes>
		</Router>
	)
}

export default Index